import Vue from "vue"
import Vuex from "vuex"

//
Vue.use(Vuex);

export default new Vuex.Store({
  state:{ //定义共享数据
    login_status:false,  //用户登录状态
    id:'',               //用户手机号码
    pswd:'',             //用户登录密码
    record_status:false, //用户档案状态 true代表该用户存在档案
    record_apply:false,  //用户档案可修改性
    myRecord_status:true, //我的档案状态
    message_status:false,  //用户消息状态 true代表有未读消息
    admin_status:false,   //是否为管理员登录，true代表当前登录的为管理员
  },
  mutations:{ //定义对共享数据的修改方法，方法中都有一个默认参数，传递状态对象
    changeLogin_Status(state){
      state.login_status = !state.login_status;
    },
    setId(state,id){
      state.id = id;
    },
    setPswd(state,pswd){
      state.pswd = pswd;
    },
    changeRecord_Status(state){
      state.record_status = true;
    },
    setRecord(state,record){
      state.record = record;
    },
    changeRecord_ApplyToTrue(state){
      state.record_apply = true;
    },
    changeRecord_ApplyToFalse(state){
      state.record_apply = false;
    },
    changeMyRecord_StatusToTrue(state){
      state.myRecord_status = true;
    },
    changeMyRecord_StatusToFalse(state){
      state.myRecord_status = false;
    },
    changeMessage_StatusToTrue(state){
      state.message_status = true;
    },
    changeMessage_StatusToFalse(state){
      state.message_status = false;
    },
    changeAdmin_StatusToTrue(state){
      state.admin_status = true;
    },
    changeAdmin_StatusToFalse(state){
      state.admin_status = false;
    },
  },
  actions:{

  },
  getters:{

  }
});
